//获取应用实例
const app = getApp();
// 引入AES.js
var baseJs = require("../../common/base.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 
    uid: "",
    makerData: [],
    isAgentHeHuoRen: "",
    userShopType: "",
    agentId: "",
  },

  

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    this.setData({
      uid: wx.getStorageSync('uid'),
    })
    this.GetMyPartnerInfo();
    this.GetUserInfoByIDs();
  },

  
  GetMyPartnerInfo: function() {
    var that = this;
    var uid = this.data.uid;
    var makerData = this.data.makerData;
    wx.request({
      url: baseJs.api + baseJs.encryUrl("method=GetMyPartnerInfo&UID=" + uid),
      success: function(res) {
        console.log(JSON.parse(baseJs.decryUrl(res.data)));
        makerData = JSON.parse(baseJs.decryUrl(res.data)).ResultData;
        that.setData({
          makerData: makerData,
        })

      }
    })

  },
  // 
  GetUserInfoByIDs: function() {
    var that = this;
    var uid = this.data.uid;
    var isAgentHeHuoRen = this.data.isAgentHeHuoRen;
    var userShopType = this.data.userShopType;
    var agentId = this.data.agentId;
    wx.request({
      url: baseJs.api + baseJs.encryUrl("method=GetUserInfoByIDs&UID=" + uid),
      success: function(res) {
        console.log(JSON.parse(baseJs.decryUrl(res.data)));
        var json = JSON.parse(baseJs.decryUrl(res.data));
        isAgentHeHuoRen = json.ResultData.IsAgentHeHuoRen;
        userShopType = json.ResultData.UserShopType;
        agentId = json.ResultData.AgentId;
        that.setData({
          isAgentHeHuoRen: isAgentHeHuoRen,
          userShopType: userShopType,
          agentId: agentId,
        })

      }
    })

  },
})